package com.webdemo08.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.webdemo08.actionform.UserForm;
import com.webdemo08.service.UserService;

public class DeleteUser extends Action {
private UserService userService;
	
	public UserService getUserService() {
		return userService;
	}
	public void setUserService(UserService userService) {
		this.userService = userService;
	}
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		UserForm userForm = (UserForm)form;
		userService.deleteUser(userForm.getId());
		ActionForward actionForward = new ActionForward("/queryUser.do");
		actionForward.setRedirect(true);
		return actionForward;
	}
}
